package com.fbs.wowo.forum.mapper;

import com.fbs.wowo.forum.entity.Likes;
import org.apache.ibatis.jdbc.SQL;

public class LikesSqlProvider {

    public String insertSelective(Likes record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("likes");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=VARCHAR}");
        }
        
        if (record.getLikeEntity() != null) {
            sql.VALUES("like_entity", "#{likeEntity,jdbcType=VARCHAR}");
        }
        
        if (record.getLikeType() != null) {
            sql.VALUES("like_type", "#{likeType,jdbcType=INTEGER}");
        }
        
        if (record.getUserId() != null) {
            sql.VALUES("user_id", "#{userId,jdbcType=VARCHAR}");
        }
        
        if (record.getStatus() != null) {
            sql.VALUES("status", "#{status,jdbcType=INTEGER}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(Likes record) {
        SQL sql = new SQL();
        sql.UPDATE("likes");
        
        if (record.getLikeEntity() != null) {
            sql.SET("like_entity = #{likeEntity,jdbcType=VARCHAR}");
        }
        
        if (record.getLikeType() != null) {
            sql.SET("like_type = #{likeType,jdbcType=INTEGER}");
        }
        
        if (record.getUserId() != null) {
            sql.SET("user_id = #{userId,jdbcType=VARCHAR}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("status = #{status,jdbcType=INTEGER}");
        }
        
        sql.WHERE("id = #{id,jdbcType=VARCHAR}");
        
        return sql.toString();
    }
}